/*
 * @Author: wangdazhuang
 * @Date: 2024-08-26 17:14:24
 * @LastEditTime: 2024-10-24 19:19:06
 * @LastEditors: ziqi jhzq12345678
 * @Description: 
 * @FilePath: /pornhub_app/lib/src/views/launch/launch_page.dart
 */

import 'package:pornhub_app/services/app_service.dart';
import 'package:pornhub_app/services/storage_service.dart';

import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:pornhub_app/views/launch/select_line.dart';
import 'package:pornhub_app/views/launch/step1_page.dart';

class LaunchPage extends StatefulWidget {
  const LaunchPage({super.key});
  @override
  State<StatefulWidget> createState() {
    return LaunchState();
  }
}

class LaunchState extends State<LaunchPage> {
  final strogeService = Get.find<StorageService>();
  ValueNotifier<bool> pass = ValueNotifier(true);

  Future init() async {
    await Get.putAsync(() => AppService().init());
    pass.value = false;
  }

  @override
  void initState() {
    init();
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ValueListenableBuilder(
      valueListenable: pass,
      builder: (context, value, child) {
        return value ? const SelectLine() : const Step1Page();
      },
    );
  }
}
